+++ /dev/null
-The build currently fails with:
-
-[..]
-
-# Build final cargo binary and docs
-/usr/bin/make
-make[2]: Entering directory '/build/cargo-0.17.0'
-/usr/bin/rustc -V
-rustc 1.15.1
-/build/cargo-0.17.0/cargo-stage0 --version
-cargo 0.15.0 (built 2016-11-26)
-/build/cargo-0.17.0/cargo-stage0 build --target x86_64-unknown-linux-gnu --manifest-path /build/cargo-0.17.0//Cargo.toml --release --verbose
-warning: custom registry support via the `registry.index` configuration is being removed, this functionality will not work in the future
- Updating registry `file:///build/cargo-0.17.0/vendor/index`
-error: no matching package named `backtrace` found (required by `error-chain`)
-location searched: registry file:///build/cargo-0.17.0/vendor/index
-version required: *
-Makefile:128: recipe for target 'cargo-x86_64-unknown-linux-gnu' failed
-
-[..]
-
-We need to fix d/cargo-vendor-pack.py and probably -unpack.py as well
--- /dev/null
+#!/usr/bin/env python3
+
+# Copyright: 2015 The Debian Project
+# License: MIT-License or Apache-2.0
+#
+# Helper to remove removed-files from .cargo-checksum
+# TODO: rewrite to perl and add to dh-cargo, maybe?
+
+from collections import OrderedDict
+import json
+import os
+import sys
+
+def main(pkgdir):
+ os.chdir(pkgdir)
+ with open(".cargo-checksum.json") as fp:
+ sums = json.load(fp, object_pairs_hook=OrderedDict)
+
+ oldfiles = sums["files"]
+ newfiles = OrderedDict([entry for entry in oldfiles.items() if os.path.exists(entry[0])])
+ sums["files"] = newfiles
+
+ if len(oldfiles) > len(newfiles):
+ with open(".cargo-checksum.json", "w") as fp:
+ json.dump(sums, fp, separators=(',', ':'))
+
+if __name__ == "__main__":
+ main(sys.argv[1] if len(sys.argv) > 1 else ".")
+++ /dev/null
-#!/usr/bin/env python
-
-# Copyright: 2015 The Debian Project
-# License: MIT-License or Apache-2.0
-#
-# Helper to generate a crate registry from local unpacked crates
-# TODO: very bad code. It should be rewritten in perl and converted into dh_cargo
-
-import json
-import os
-import tarfile
-import string
-import pytoml
-from dulwich.repo import Repo
-import hashlib
-from collections import OrderedDict
-
-
-# TODO: hackish, at best. features need to be properly parsed
-def parse_deps(toml):
- deps=[]
- if 'dependencies' not in toml:
- return deps
- d = toml['dependencies']
- if 'target' in toml:
- t = toml['target']
- if 'x86_64-unknown-linux-gnu' in t:
- t = t['x86_64-unknown-linux-gnu']
- if 'dependencies' in t:
- d.update(t['dependencies'])
- for k, v in d.iteritems():
- opt = False
- defa = True
- if isinstance(v, dict):
- opt = v.get('optional', opt)
- v = '*'
- i = {
- "default_features": defa,
- "features": [],
- "kind": "normal",
- "name": k,
- "optional": opt,
- "req": v,
- "target": None
- }
- deps.append(i)
- if 'build-dependencies' not in toml:
- return deps
- d = toml['build-dependencies']
- for k, v in d.iteritems():
- opt = False
- defa = True
- if isinstance(v, dict):
- opt = v.get('optional', opt)
- v = '*'
- i = {
- "default_features": defa,
- "features": [],
- "kind": "build",
- "name": k,
- "optional": opt,
- "req": v,
- "target": None
- }
- deps.append(i)
- if 'dev-dependencies' not in toml:
- return deps
- d = toml['dev-dependencies']
- for k, v in d.iteritems():
- opt = False
- defa = True
- if isinstance(v, dict):
- opt = v.get('optional', opt)
- v = '*'
- i = {
- "default_features": defa,
- "features": [],
- "kind": "dev",
- "name": k,
- "optional": opt,
- "req": v,
- "target": None
- }
- deps.append(i)
- return deps
-
-def main():
- curdir = os.getcwd()
- depsdir = os.path.join(curdir, "deps")
- vendordir = os.path.join(curdir, "vendor")
- cachedir = os.path.join(vendordir, "cache")
- indexdir = os.path.join(vendordir, "index")
- cargocfgdir = os.path.join(curdir, ".cargo")
- for d in [cachedir, indexdir]:
- if not os.path.exists(d):
- os.makedirs(d)
-
- indexdict = OrderedDict()
- for crate in os.listdir(depsdir):
- if os.path.isdir(os.path.join(depsdir, crate)) and not crate.startswith('.'):
- (name, ver) = string.rsplit(crate, '-', 1)
- print("Found %s ver. %s (at %s)" % (name, ver, os.path.join(depsdir, crate)))
- destdir=(os.path.join(cachedir, name, ver))
- os.makedirs(destdir)
- tarcrate = os.path.join(destdir, "download")
- tar = tarfile.open(tarcrate, "w:gz", format=tarfile.USTAR_FORMAT)
- tar.add(os.path.join(depsdir, crate), arcname=crate)
- tar.close()
-
- manif = None
- with open(os.path.join(depsdir,crate,'Cargo.toml'), 'rb') as f:
- manif = pytoml.load(f)
-
- nestdir = None
- if len(name) >= 4:
- nestdir = os.path.join(indexdir, name[0:2], name[2:4])
- else:
- nestdir = os.path.join(indexdir, '3', name[0])
-
- cksum = hashlib.sha256(open(tarcrate, 'rb').read()).hexdigest()
- indexdict[name] = OrderedDict([
- ('name', name),
- ('vers', ver),
- ('deps', parse_deps(manif)),
- ('features', manif.get('features',{})),
- ('cksum', cksum),
- ('yanked', False)
- ])
- if not os.path.exists(nestdir):
- os.makedirs(nestdir)
- with open(os.path.join(nestdir, name), 'a') as outfile:
- json.dump(indexdict[name], outfile, sort_keys=False)
- outfile.write('\n')
-
-
- configjson = {
- 'api': '',
- 'dl': "file://{0}".format(cachedir)
- }
- with open(os.path.join(indexdir, 'config.json'), 'w') as outfile:
- json.dump(configjson, outfile)
-
- p = []
- for dirpath, _, paths in os.walk(indexdir):
- for f in paths:
- p.append(os.path.relpath(os.path.join(dirpath,f), indexdir))
-
- repo=Repo.init(indexdir)
- for f in paths:
- repo.stage(p)
- repo.do_commit(b"Fake commit", committer=b"Cargo debhelper <pkg-rust-maintainers@lists.alioth.debian.org>")
-
- cfg="""[registry]
-index = "file://{0}"
-"""
- if not os.path.exists(cargocfgdir):
- os.makedirs(cargocfgdir)
-
- with open(os.path.join(cargocfgdir, "config"), "w") as cfgfile:
- cfgfile.write(cfg.format(indexdir))
-
-if __name__ == "__main__":
- main()
-#!/usr/bin/env python
+#!/usr/bin/env python3
# Copyright: 2015 The Debian Project
# License: MIT-License or Apache-2.0
#
# Helper to unpack a local crate registry to original sources
-# TODO: rewrite to perl, maybe?
+# TODO: rewrite to perl and add to dh-cargo, maybe?
import os
import tarfile
--- /dev/null
+[source.crates-io]
+replace-with = "dh-cargo-registry"
+
+[source.dh-cargo-registry]
+directory = "../deps"
# Unpack artifacts and clean embedded libs
${WORKDIR}/debian/cargo-vendor-unpack.py
grep -v '^#' ${DEPS_FILTER} | xargs -I% sh -c 'rm -rf deps/%'
+for i in deps/*; do ${WORKDIR}/debian/cargo-checksums-prune.py "$i"; done
# Report any suspicious files
cp -R deps deps-scan
+++ /dev/null
-From: Luca Bruno <lucab@debian.org>
-Description: Adjust deps dependencies
- This is a workaround for bugs in the embedding script
-Forwarded: not-needed
-
---- a/deps/tar-0.4.9/Cargo.toml
-+++ b/deps/tar-0.4.9/Cargo.toml
-@@ -25,7 +25 @@
- tempdir = "0.3"
--
--[target."cfg(unix)".dependencies]
--xattr = { version = "0.1.7", optional = true }
--
--[features]
--default = ["xattr"]
---- a/deps/libgit2-sys-0.6.6/Cargo.toml
-+++ b/deps/libgit2-sys-0.6.6/Cargo.toml
-@@ -20,2 +20,3 @@
- libz-sys = ">= 0"
-+openssl-sys = { version = "0.9", optional = true }
-
-@@ -26,5 +27,2 @@
-
--[target."cfg(all(unix, not(target_os = \"macos\")))".dependencies]
--openssl-sys = { version = "0.9", optional = true }
--
- [features]
---- a/deps/git2-0.6.3/Cargo.toml
-+++ b/deps/git2-0.6.3/Cargo.toml
-@@ -22,4 +22,2 @@
- libgit2-sys = { path = "libgit2-sys", version = "0.6.4" }
--
--[target."cfg(all(unix, not(target_os = \"macos\")))".dependencies]
- openssl-sys = { version = "0.9.0", optional = true }
---- a/deps/fs2-0.3.0/Cargo.toml
-+++ b/deps/fs2-0.3.0/Cargo.toml
-@@ -10,3 +10,3 @@
-
--[target.'cfg(unix)'.dependencies]
-+[dependencies]
- libc = "0.2.2"
---- a/deps/libssh2-sys-0.2.5/Cargo.toml
-+++ b/deps/libssh2-sys-0.2.5/Cargo.toml
-@@ -17,4 +17,2 @@
- libc = "0.2"
--
--[target."cfg(unix)".dependencies]
- openssl-sys = "0.9"
---- a/deps/curl-sys-0.3.6/Cargo.toml
-+++ b/deps/curl-sys-0.3.6/Cargo.toml
-@@ -22,4 +22,2 @@
- libc = "0.2"
--
--[target."cfg(all(unix, not(target_os = \"macos\")))".dependencies]
- openssl-sys = "0.9"
---- a/deps/curl-0.4.1/Cargo.toml
-+++ b/deps/curl-0.4.1/Cargo.toml
-@@ -13,5 +13,2 @@
- curl-sys = { path = "curl-sys", version = "0.3" }
--
--# Unix platforms use OpenSSL for now to provide SSL functionality
--[target."cfg(all(unix, not(target_os = \"macos\")))".dependencies]
- openssl-sys = "0.9.0"
clean-cargo-deps.patch
-deps-adjust.patch
local-jquery.patch
DEB_TARGET_RUST_TYPE := $(call rust_cpu,$(DEB_TARGET_GNU_CPU))-unknown-$(DEB_TARGET_GNU_SYSTEM)
# Cargo looks for config in and writes cache to $CARGO_HOME/
-export CARGO_HOME = $(CURDIR)/.cargohome
+export CARGO_HOME = $(CURDIR)/debian/cargohome
# Ask cargo to be verbose when building
export VERBOSE = 1
override_dh_auto_configure:
cp -a $(CURDIR)/Cargo.lock $(CURDIR)/.Cargo.lock.orig
- # Prepare a fake registry by packing all deps
- ./debian/cargo-vendor-pack.py
override_dh_auto_build:
ifneq ($(filter stage0,$(DEB_BUILD_PROFILES)),)
--host=$(DEB_HOST_RUST_TYPE) \
--target=$(DEB_TARGET_RUST_TYPE)
# Workaround for https://github.com/rust-lang/cargo/issues/1423
- mv $(DEPSDIR) $(CURDIR)/.deps
- ln -s `find $(CURDIR)/.deps -name 'cargo-*' -type f -executable` $(CURDIR)/cargo-stage0
+ ln -s `find $(DEPSDIR) -name 'cargo-*' -type f -executable` $(CURDIR)/cargo-stage0
else
ln -s `which cargo` $(CURDIR)/cargo-stage0
- # Workaround for https://github.com/rust-lang/cargo/issues/1423
- mv $(DEPSDIR) $(CURDIR)/.deps
endif
# Configure to build cargo using the just-built stage0
./configure \
cd target/doc/ && rm -f jquery.js && ln -s /usr/share/javascript/jquery/jquery.js
endif
- # Restore from workarounds
- mv $(CURDIR)/.deps $(DEPSDIR)
-
override_dh_auto_clean:
-mv $(CURDIR)/.Cargo.lock.orig $(CURDIR)/Cargo.lock
- -mv $(CURDIR)/.deps $(DEPSDIR)
dh_auto_clean
-$(RM) -r $(CURDIR)/deps/*.rlib \
$(CURDIR)/deps/build_script* \
$(CURDIR)/deps/cargo* \
$(CURDIR)/deps/*.o \
$(CURDIR)/target/ \
- $(CURDIR)/.cargo/ \
+ $(CURDIR)/.cargo \
$(CURDIR)/config.mk \
$(CURDIR)/config.stamp \
$(CURDIR)/Makefile \
$(CURDIR)/cargo-stage0 \
- $(CARGO_HOME) \
$(VENDORDIR)
override_dh_auto_install: